package com.leetcode.August;

/**
 * @Description: 80. 删除有序数组中的重复项 II
 * @Author: Mr.Fxy
 * @CreateTime: 2024-08-15 21:24
 */
public class LC80删除有序数组中的重复项II {
    public int removeDuplicates(int[] nums) {
            if(nums.length<=2)return  nums.length;
            int slow=2;
            for(int fast=2;fast<nums.length;fast++){
                if(nums[slow-2]!=nums[fast]){
                    nums[slow]=nums[fast];
                    slow++;
                }
            }
            return slow;
    }
}
